package ciyuan.Gui.Particle;

import net.minecraft.client.Minecraft;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

/**
 * @author 150149
 */
@Mod.EventBusSubscriber(value = Dist.CLIENT)
public class Events {

    @SubscribeEvent
    public static void onLivingUpdate(LivingDamageEvent event) {
        if (Minecraft.getInstance().level!=null) {
            Minecraft.getInstance().level.addParticle(new DamageParticleData(new Vector3d(0,0.02,0),(int) event.getAmount(), DamageParticleData.DamageType.physicsNormal),false,event.getEntity().getX(),event.getEntity().getY(),event.getEntity().getZ(),0,0,0);
        }
    }

}
